package system

import (
	"shopstar/models"
	"shopstar/models/system"
)

type Area struct{}

var AreaService = new(Area)

func (*Area) GetAddress(provinceId, cityid, districtid int) (*system.Province, *system.City, *system.District) {
	var (
		province = new(system.Province)
		city     = new(system.City)
		district = new(system.District)
	)

	models.DB.Where("province_id = ?", provinceId).First(province)
	models.DB.Where("city_id = ?", cityid).First(city)
	models.DB.Where("district_id = ?", districtid).First(district)

	return province, city, district
}
